package com.sky.city.request;

import android.content.Context;

import com.common.baselibrary.rxjava2.BaseObserver;
import com.common.baselibrary.rxjava2.ResponseCallBack;
import com.sky.city.interceptor.RetrofitHelper;

import okhttp3.RequestBody;

public class RequestManager {



    /**
     * 登录
     */
    public static void login(Context context, RequestBody requestBody, OnResponseListener onResponseListener) {
        RetrofitHelper.getInstance().login(requestBody).subscribe(new BaseObserver<String>(context, true, new ResponseCallBack() {
            @Override
            public void onSuccess(Object o) {
                if (onResponseListener != null) {
                    onResponseListener.onSuccess(o);
                }
            }

            @Override
            public void onFault(String errorMsg) {
                if (onResponseListener != null) {
                    onResponseListener.onFailre(errorMsg);
                }
            }
        }));
    }


    public interface OnResponseListener {
        void onSuccess(Object object);

        void onFailre(String msg);
    }

}
